package test.java.test;

import main.java.game.AdvancedTwoPlayersGame;
import main.java.game.CircusTrainGame;
import main.java.gameState.GameState;
import main.java.gameState.GreenState;
import java.util.List;
import java.util.Map;
import main.java.performance.PerformanceDemand;
import main.java.performance.PerformanceDemandImpl;
import main.java.player.Player;
import main.java.player.PlayerImpl;
import main.java.talent.Clown;
import main.java.talent.ClownImpl;
import main.java.talent.Elephant;
import main.java.talent.ElephantImpl;
import main.java.talent.Talent;
import main.java.utiles.factoria.CollectionsFactory;
import main.java.utiles.factoria.readDataFromKeyBoard;
import main.java.actionCards.ActionCard;
import main.java.actionCards.BasicMoveImpl;
import main.java.actionCards.FastMoveImpl;
import main.java.actionCards.HoldImpl;
import main.java.actionCards.OvernighterImpl;
import main.java.actionCards.RestImpl;
import main.java.actionCards.TravelImpl;
import main.java.actionCards.WagesImpl;
import main.java.board.Board;
import main.java.board.BoardImpl;

public class testActionCards extends Test {

	/**
	 * @param args
	 */

	public static void main(String[] args) {
		GameState ge = new GreenState(new AdvancedTwoPlayersGame());
		CircusTrainGame cg = new AdvancedTwoPlayersGame();
		Board b = new BoardImpl("src/main/resources/data/boardcfg.txt");
		Clown cl = new ClownImpl();
		Elephant el = new ElephantImpl();
		Player p = new PlayerImpl("Pepe");
		List<Talent> lt = CollectionsFactory.createListFactory().createList();
		p.moveCity(b.getCityByName("Toronto"));
		p.addMoney(15);
		Map<Talent, Integer> talentPoints= CollectionsFactory.createMapFactory().createMap();
		talentPoints.put(cl, 3);
		List<Talent> talents  = CollectionsFactory.createListFactory().createList();
		talents.add(el);
		talents.add(cl);
		talents.add(cl);
		talents.add(cl);
		talents.add(cl);
		talents.add(cl);
		lt.add(cl);
		lt.add(cl);
		p.addTalent(talents);
		//BankruptCircus bk = new BankruptCircusImpl("Rojo", "soy un pudrecolchones",lt );
		PerformanceDemand pd = new PerformanceDemandImpl("green", "Bla Bla Bla", 2, talentPoints, false);
		p.getCity().setPerfomance(pd);
		System.out.println(p);
		System.out.println("Elegir carta de acción a usar:\n" +
				"[0]Viaje\n" +
				"[1][2]Movimiento Básico\n" +
				"[3]Movimiento Rápido\n" +
				"[4]Salarios\n" +	
				"[5]De noche\n" +
				"[6]Descanso\n" +
				"[7]Quedarse");
		Integer elec = readDataFromKeyBoard.takeParametersToIntegerTopValue("Opcion:", 7);
		
		if (elec == 0){
			ActionCard ac = new TravelImpl(p);
			ac.execute(ge);
		}
		if (elec == 1 || elec == 2){
			ActionCard ac = new BasicMoveImpl(p);
			ac.execute(ge);
		}
		if (elec == 3){
			ActionCard ac = new FastMoveImpl(p);
			ac.execute(ge);
		}
		if (elec == 4){
			ActionCard ac = new WagesImpl(cg,p);
			ac.execute(ge);
		}
		if (elec == 5){
			ActionCard ac = new OvernighterImpl(p);
			ac.execute(ge);	
		}
		if (elec == 6){
			ActionCard ac = new RestImpl(cg,p);
			ac.execute(ge);
		}
		if (elec == 7){
			ActionCard ac = new HoldImpl(p);
			ac.execute(ge);
		}
		System.out.println(p.getMoney());
		System.out.println("La ciudad actual de "+p.getName()+" es " + p.getCity());
		System.out.println("La ejecución ha terminado correctamente");
	}
}
